﻿using System;
using System.Collections.Generic;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;

namespace YEA.Infrastructure.Gateway.Stubs
{
    public class NullConnection : IConnection
    {
        public void Abort(ushort reasonCode, string reasonText, int timeout)
        {
        }

        public void HandleConnectionBlocked(string reason)
        {
            throw new System.NotImplementedException();
        }

        public void HandleConnectionUnblocked()
        {
            throw new System.NotImplementedException();
        }

        public void Abort(int timeout)
        {
        }

        public void Abort(ushort reasonCode, string reasonText)
        {
        }

        public void Abort()
        {
        }

        public bool AutoClose
        {
            get
            {
                return true;
            }
            set
            {
                ;
            }
        }

        public event RabbitMQ.Client.Events.CallbackExceptionEventHandler CallbackException;
        public event ConnectionBlockedEventHandler ConnectionBlocked;
        public event ConnectionUnblockedEventHandler ConnectionUnblocked;

        public ushort ChannelMax
        {
            get { return 1; }
        }

        public System.Collections.IDictionary ClientProperties
        {
            get { return new System.Collections.Hashtable(); }
        }

        IDictionary<string, object> IConnection.ServerProperties { get {throw new NotImplementedException();} }

        public void Close(ushort reasonCode, string reasonText, int timeout)
        {
        }

        public void Close(int timeout)
        {
        }

        public void Close(ushort reasonCode, string reasonText)
        {
        }

        public void Close()
        {
        }

        public ShutdownEventArgs CloseReason
        {
            get { return new ShutdownEventArgs(new ShutdownInitiator(), 200, "test"); }
        }

        IList<ShutdownReportEntry> IConnection.ShutdownReport {
            get { throw new NotImplementedException();}
        }
        public event RabbitMQ.Client.Events.ConnectionShutdownEventHandler ConnectionShutdown;

        public IModel CreateModel()
        {
            return new NullModel();
        }

        public AmqpTcpEndpoint Endpoint
        {
            get { return new AmqpTcpEndpoint(); }
        }

        public uint FrameMax
        {
            get { return 1; }
        }

        public ushort Heartbeat
        {
            get { return 0; }
        }

        IDictionary<string, object> IConnection.ClientProperties {
            get { throw new NotImplementedException(); }
        }

        public bool IsOpen
        {
            get { return true; }
        }

        public AmqpTcpEndpoint[] KnownHosts
        {
            get { return null; }
        }

        public IProtocol Protocol
        {
            get { throw new System.NotImplementedException(); }
        }

        public System.Collections.IDictionary ServerProperties
        {
            get { throw new System.NotImplementedException(); }
        }

        public System.Collections.IList ShutdownReport
        {
            get { throw new System.NotImplementedException(); }
        }

        public void Dispose()
        {
        }
    }
}
